//组合继承
// function Father(name) {
//     this.name = name
// }

// Father.prototype.say = function() {
//     console.log('this is father')
// }

// function Child(name) {
//     Father.call(this, name)
// }

// Child.prototype = new Father()

// const child = new Child('kaho') 

// child.say()

//原型式继承
// function Father(obj) {
//     const Fn = function() {}
//     Fn.prototype = obj
//     return new Fn()
// }

// const obj = {name: 'kaho'}

// // const son = Father(obj)
// const son = Object.create(obj)

// console.log(son.__proto__)

//寄生组合继承
function Father(name) {
    this.name = name
}

Father.prototype.say = function() {
    console.log('this is father')
}

function Child(name) {
    Father.call(this, name)
}

Child.prototype = Object.create(Father.prototype)
Child.prototype.constructor = Child

const child = new Child('kaho') 

child.say()